package com.htu.lichen.exception;

import com.htu.lichen.enums.ResultEnum;
import lombok.Data;

/**
 * @Author: lichen
 * @Date: 12/28/20 7:07 PM
 */

@Data
public class ProductException extends RuntimeException {

    private static final long serialVersionUID = 2450214686001409867L;

    private Integer errorCode = ResultEnum.ERROR.getCode();

    public ProductException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.errorCode = resultEnum.getCode();
    }

    public ProductException(ResultEnum resultEnum, Throwable throwable) {
        super(resultEnum.getMsg(), throwable);
        this.errorCode = resultEnum.getCode();
    }

    public ProductException(Integer errorCode, String msg) {
        super(msg);
        this.errorCode = errorCode;
    }

    public ProductException(String msg) {
        super(msg);
    }

    public ProductException(Throwable throwable) {
        super(throwable);
    }

    public ProductException(String msg, Throwable throwable) {
        super(msg, throwable);
    }

    public Integer getErrorCode() {
        return errorCode;
    }

}
